package com.yzd.learnjava.reusing;

import com.yzd.learnjava.util.Print;

public class Detergent extends Cleanser{

	public void scrub() {
		append(" Detergent.scrub()");
		super.scrub();
	}
	
	public void foam() {
		append(" foam()");
	}
	public static void main(String[] args) {
		Detergent y = new Detergent();
		y.dilute();
		y.apply();
		y.scrub();
		y.foam();
		Print.print(y);
		Print.print("Testing Base class");
		Cleanser.main(args);
	}

}

class Cleanser{
	private String s = "Cleanser";
	public void append(String a) {
		s += a;
	}
	public void dilute() {
		append(" dilute()");
	}
	
	public void apply() {
		append(" apply()");
	}
	public void scrub() {
		append(" scrub()");
	}
	
	public String toString() {
		return s ;
	}
	
	public static void main(String[] args) {
		Cleanser x = new Cleanser();
		x.dilute();
		x.apply();
		x.scrub();
		Print.print(x);
	}
}
